fix bugs. it's working now