Bug fix

some minor bug fixes