fixing bug with nil values (Issue 11)