What a bad night sleep can do, and how to fix it