Fixing some bugs

Thanks @hannah-grape!