Found some bug and fixed them