Some Bug fixes