Bug fixes after testing