Fixes various issues