Bug fixes

Fix 3 small bugs.Maybe more to come