Bugfixing

FIxed bugs:
http://jira.qalight.com/browse/BUIL-42
http://jira.qalight.com/browse/BUIL-15