Fixed small bugs from previous commit