Fixes bugs for last commit