Fixed bugs and added try..catch

Signed-off-by: RufusSwart <rufus.swart@swrt.co.za>