Added some error message and fix to gui