Misc fixes

@lileicc 

This fixes some bugs I noticed in the 0.9 beta.