More bug fixing and error removing