Minor bug fixes caused by previous hasty commits