Fixes for several issues