added a little bug fixing code