removed unused var added error log
merged