found some bugs on functions that didn't return what they should