Fixes for a lot of issues