fixed issues as per comments