Fixed some unnoticed bugs