Bug fixes for scaling issues