Fix various issues found by eric

@hkal 

https://www.pivotaltracker.com/story/show/66801508
https://www.pivotaltracker.com/story/show/67390630
https://www.pivotaltracker.com/story/show/67391608