Added several fixes