Fixing some bugs and issues