Corrected bugs from last commit