Fixed various exceptions
Added bug