some error checking and gui errors fixes