Fixed 3 bugs