fixes for bad behavior
good stuff from reddit