Fix

Fixed various bugs