added createSocketFolder to ensure socket folder exists
corrected return code on error