added array check and doPost