work around double submit issue (csrf measure) and fixed some warnings