solving some bugs from previous commit